package com.miyake.dsp.osa.lab.wrapper;

import com.miyake.dsp.osa.lab.Calculator;
import com.miyake.dsp.osa.lab.LabUiAnnotation;
import com.miyake.dsp.otdr.RealOtdr;
import com.miyake.dsp.otdr.RealOtdrSetting;
@LabUiAnnotation(caption="uOTDR")
public class MicroOtdrWrapper extends Calculator {
	public static final String OUTPUT = "Loss";
	
	private RealOtdr otdr = new RealOtdr();

	private RealOtdrSetting setting;
	public MicroOtdrWrapper(RealOtdrSetting setting) {
		initOutput(OUTPUT);
		this.setting = setting;
	}
	
	@Override
	public void process() {
		otdr.open(setting.getIp(), setting.getPort());
		otdr.setDistanceRange(setting.getDistanceRange().toString());
		otdr.setPulsewidth(setting.getPulseWidth().toString());
		otdr.startSingleSweep();
		setOutput(OUTPUT, otdr.getTrace());
	}

	@Override
	public Object getSetting() {
		return this.setting;
	}

}
